const CODE = {
  SUCCESS: 200,
  PARAM_ERROR: 10001, // 参数错误
  USER_ACCOUNT_ERROR: 20001, // 账户或密码错误
  USER_LOGIN_ERROR: 30001, // 用户未登录
  BUSINESS_ERROR: 40001, // 业务请求失败
  AUTH_ERROR: 50001 // 认证失败
}

class BaseModel {
  constructor(data, message, code) {
    if (data) {
      this.data = data
    }
    if (message) {
      this.message = message
    }
    if (code) {
      this.code = code
    }
  }
}

class SuccessModel extends BaseModel {
  constructor(data, message) {
    super(data, message)
    this.code = CODE.SUCCESS
  }
}

class ErrorModel extends BaseModel {
  constructor(data, message, code) {
    super(data, message, code)
  }
}

module.exports = {
  SuccessModel,
  ErrorModel
}
